---
apiVersion: v1
kind: Secret
metadata:
  name: d8-cni-configuration
  namespace: kube-system
  {{- include "helm_lib_module_labels" (list .) | nindent 2 }}
data:
{{- if hasKey .Values.cloudProviderOpenstack.internal "cniSecretData" }}
  {{- .Values.cloudProviderOpenstack.internal.cniSecretData | b64dec | nindent 2 }}
{{- else }}
  cni: {{ b64enc "cilium" | quote }}
  {{- if or (eq .Values.cloudProviderOpenstack.internal.podNetworkMode "DirectRouting") (eq .Values.cloudProviderOpenstack.internal.podNetworkMode "DirectRoutingWithPortSecurityEnabled") }}
  cilium: {{ b64enc "{\"mode\": \"DirectWithNodeRoutes\", \"masqueradeMode\": \"Netfilter\"}" | quote }}
  {{- else if eq .Values.cloudProviderOpenstack.internal.podNetworkMode "VXLAN" }}
  cilium: {{ b64enc "{\"mode\": \"VXLAN\", \"masqueradeMode\": \"BPF\"}" | quote }}
  {{- end }}
{{- end }}
